home *** CD-ROM | disk | FTP | other *** search
/ Network CD 2 / Network CD - Volume 2.iso / programs / internet / tcp / amitcp / amitcp-api-22.lha / AmiTCP-2.2 / netinclude / net / if_arp.h next >
Encoding:
C/C++ Source or Header  |  1993-10-28  |  5.2 KB  |  142 lines

  1. #ifndef IF_ARP_H
  2. #define IF_ARP_H
  3. /* $Id: if_arp.h,v 1.9 1993/10/29 01:43:11 ppessi Exp $
  4.  *
  5.  * Copyright (c) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>,
  6.  *                    Helsinki University of Technology, Finland.
  7.  *                    All rights reserved.
  8.  *
  9.  * if_arp.h --- Interface to the ARP Protocol
  10.  *
  11.  * HISTORY
  12.  * $Log: if_arp.h,v $
  13.  * Revision 1.9  1993/10/29  01:43:11  ppessi
  14.  * Changed the definition of arptable structure (it was unusable before)
  15.  *
  16.  * Revision 1.8  1993/07/19  14:04:42  jraja
  17.  * Added definition for ARPHRD_ARCNET.
  18.  *
  19.  * Revision 1.7  1993/06/04  11:16:15  jraja
  20.  * Fixes for first public release.
  21.  *
  22.  * Revision 1.6  1993/05/16  21:09:43  ppessi
  23.  * RCS version changed.
  24.  *
  25.  * Revision 1.5  1993/05/14  21:26:26  ppessi
  26.  * Sanitized IOCTL interface.
  27.  *
  28.  * Revision 1.4  93/04/19  02:11:41  02:11:41  ppessi (Pekka Pessi)
  29.  * ARP ioctl structure extended for 16 byte hw address.
  30.  * 
  31.  * Revision 1.3  93/03/10  21:27:08  21:27:08  ppessi (Pekka Pessi)
  32.  *     Removed CMU copyright, added #define IF_ARP_H
  33.  * 
  34.  * Revision 1.2  93/02/25  16:51:15  16:51:15  jraja (Jarno Tapio Rajahalme)
  35.  * fixed comments.
  36.  * 
  37.  * Revision 1.1  92/11/20  14:59:07  14:59:07  jraja (Jarno Tapio Rajahalme)
  38.  * Initial revision
  39.  * 
  40.  *
  41.  */
  42.  
  43. /*
  44.  * Address Resolution Protocol.
  45.  *
  46.  * See RFC 826 for protocol description.  ARP packets are variable
  47.  * in size; the arphdr structure defines the fixed-length portion.
  48.  * Protocol type values are the same as those for 10 Mb/s Ethernet.
  49.  * It is followed by the variable-sized fields ar_sha, arp_spa,
  50.  * arp_tha and arp_tpa in that order, according to the lengths
  51.  * specified.  Field names used correspond to RFC 826.
  52.  */
  53. struct    arphdr {
  54.     u_short    ar_hrd;        /* format of hardware address */
  55. #define ARPHRD_ETHER     1    /* ethernet hardware address */
  56. #define ARPHRD_ARCNET     7    /* ARCNET hardware address */
  57.     u_short    ar_pro;        /* format of protocol address */
  58.     u_char    ar_hln;        /* length of hardware address */
  59.     u_char    ar_pln;        /* length of protocol address */
  60.     u_short    ar_op;        /* one of: */
  61. #define    ARPOP_REQUEST    1    /* request to resolve address */
  62. #define    ARPOP_REPLY    2    /* response to previous request */
  63. /*
  64.  * The remaining fields are variable in size,
  65.  * according to the sizes above.
  66.  */
  67. /*    u_char    ar_sha[];    \* sender hardware address */
  68. /*    u_char    ar_spa[];    \* sender protocol address */
  69. /*    u_char    ar_tha[];    \* target hardware address */
  70. /*    u_char    ar_tpa[];    \* target protocol address */
  71. };
  72.  
  73. #define MAXADDRARP  16          /* Maximum number of octets in hw address */
  74.  
  75. /*
  76.  * ARP ioctl request. 
  77.  */
  78. struct arpreq {
  79.     struct    sockaddr arp_pa;        /* protocol address */
  80.     struct    {                        /* hardware address */
  81.       u_char sa_len;
  82.       u_char sa_family;        
  83.       char     sa_data[MAXADDRARP];        
  84.     }  arp_ha;        
  85.     int    arp_flags;            /* flags */
  86. };
  87.  
  88. /*  arp_flags and at_flags field values */
  89. #define    ATF_INUSE    0x01    /* entry in use */
  90. #define ATF_COM        0x02    /* completed entry (enaddr valid) */
  91. #define    ATF_PERM    0x04    /* permanent entry */
  92. #define    ATF_PUBL    0x08    /* publish entry (respond for other host) */
  93. #define    ATF_USETRAILERS    0x10    /* has requested trailers */
  94.  
  95. /* 
  96.  * An AmiTCP/IP specific ARP table ioctl request
  97.  */
  98. struct arptabreq {
  99.     struct arpreq  atr_arpreq; /* We want to identify the interface */
  100.     long           atr_size;          /* # of elements in art_table */
  101.     long           atr_inuse;               /* # of elements in use */
  102.     struct arpreq *atr_table;
  103. };
  104.  
  105. /*
  106.  * Copyright (c) 1986 Regents of the University of California.
  107.  * All rights reserved.
  108.  *
  109.  * Redistribution and use in source and binary forms, with or without
  110.  * modification, are permitted provided that the following conditions
  111.  * are met:
  112.  * 1. Redistributions of source code must retain the above copyright
  113.  *    notice, this list of conditions and the following disclaimer.
  114.  * 2. Redistributions in binary form must reproduce the above copyright
  115.  *    notice, this list of conditions and the following disclaimer in the
  116.  *    documentation and/or other materials provided with the distribution.
  117.  * 3. All advertising materials mentioning features or use of this software
  118.  *    must display the following acknowledgement:
  119.  *    This product includes software developed by the University of
  120.  *    California, Berkeley and its contributors.
  121.  * 4. Neither the name of the University nor the names of its contributors
  122.  *    may be used to endorse or promote products derived from this software
  123.  *    without specific prior written permission.
  124.  *
  125.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  126.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  127.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  128.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  129.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  130.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  131.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  132.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  133.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  134.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  135.  * SUCH DAMAGE.
  136.  *
  137.  *    @(#)if_arp.h    7.4 (Berkeley) 6/28/90
  138.  */
  139. #endif /* IF_ARP_H */
  140.  
  141.  
  142.